//
//  ViewController.swift
//  ZLExtension
//
//  Created by Zz_l on 01/08/2023.
//  Copyright (c) 2023 Zz_l. All rights reserved.
//

import UIKit
import ZLExtension

class ViewController: UIViewController {
    var v: UIView?
    override func viewDidLoad() {
        super.viewDidLoad()
        let string = "截取人任意位置到结束"
        print(string.zl_subString(from: 3))
        print(string.zl_subString(to: 3))
        print(string.zl_subString(local: 3, length: 3))
        print(string.zl_remove(local: 3, length: 30))
        print(string.zl_remove(from: 3))
        print(string.zl_remove(to: 3))
        
        self.view.backgroundColor = ZLRandomColor()
        
        v = UIView(frame: CGRect(x: 50, y: 100, width: 100, height: 100))
        v!.backgroundColor = ZLRandomColor()
        v!.zl_gradient(colors: [UIColor.blue, UIColor.green, UIColor.orange, UIColor.red])
        v!.zl_cornerRadius(20, corners: [.topRight, .bottomLeft])
        v!.zl_addTap(target: self, selector: #selector(viewAction))
        self.view.addSubview(v!)
    }
    
    /// 点击
    @objc func viewAction() {
        v!.zl_removeGradientLayer()
    }
    
//    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
//        self.view.backgroundColor = ZLRandomColor()
//    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

